<?php
/**
 * Tiny - A PHP Framework For Web Artisans
 * @author Tiny <tinylofty@gmail.com>
 * @copyright Copyright(c) 2010-2014 http://www.tinyrise.com All rights reserved
 * @version 1.0
 */
/**
 * String 类
 *
 * @author Tiny
 * @class TString
 */
 class Lang
 {
 	private static $_lang = array();
 	
 	/**
 	 * 设置语言内容
 	 *
 	 * @access public
 	 * @param mixed $name
 	 * @param string $value
 	 * @return 
 	 */
 	public static function set($name, $value = null)
 	{
 		if (empty($name))
 			return ;
 		// 判断语言获取(或设置)
 		// 若不存在,直接返回全大写$name
 		if (is_string($name)) {
 			$name = strtoupper($name);
 			self::$_lang[$name] = $value; // 语言定义
 			return;
 		}
 		// 批量定义
 		if (is_array($name))
 			self::$_lang = array_merge(self::$_lang, array_change_key_case($name, CASE_UPPER));
 		return;
 	}
 	/**
 	 * 获取语言内容
 	 *
 	 * @access public
 	 * @param string $name|null
 	 * @return array|string
 	 */
 	public static function get($name = null)
 	{
 		if (is_null($name))
 			return self::$_lang;
 		
 		$name = strtoupper($name);
 		return self::$_lang[$name];
 	}
 }